package com.yb.guigu.pick.security.bean;

import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/5/31 15:07
 * FileName: GuiguAbstractAutuenticationToken
 * Description:
 */

public class GuiguMobileCodeAuthenticationToken extends GuiguAbstractAuthenticationToken {
    /**
     * Creates a token with the supplied array of authorities.
     *
     * @param authorities the collection of <tt>GrantedAuthority</tt>s for the principal
     * represented by this authentication object.
     */
    private String phone;

    private String code;


    public GuiguMobileCodeAuthenticationToken(GuiguPickUser guiguPickUser) {
        super(guiguPickUser);
        this.phone=guiguPickUser.getPhone();
        this.code=guiguPickUser.getCode();
    }


    public GuiguMobileCodeAuthenticationToken(GuiguPickUser guiguPickUser, Collection<? extends GrantedAuthority> authorities) {
        super(guiguPickUser,authorities);
        this.phone=guiguPickUser.getPhone();
        this.code=guiguPickUser.getCode();
    }


    public static GuiguMobileCodeAuthenticationToken authenticated(GuiguPickUser guiguPickUser, Collection<? extends GrantedAuthority> authorities){

        return new GuiguMobileCodeAuthenticationToken(guiguPickUser,authorities);
    }

    public static GuiguMobileCodeAuthenticationToken unAuthenticated(GuiguPickUser guiguPickUser){
        return new GuiguMobileCodeAuthenticationToken(guiguPickUser);
    }


    public String getPhone() {
        return phone;
    }

    public String getCode() {
        return code;
    }
}

